package com.controller;

import com.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }
    //返回值中存在实体类，才会被扫描到
    @RequestMapping("/user")
      public User user(){
        return new User();
    }
    @ApiOperation("user控制类")
    @GetMapping("/user2")
    public String user1(String password){
        return "Hello"+password;
    }

    @ApiOperation("user控制类之@ApiParam")
    @PostMapping("/user3")
    public String user2(@ApiParam("密码")@RequestParam String password){
        return "Hello"+password;
    }


    @ApiOperation("user控制类之@ApiParam的实体类参数")
    @PostMapping("/user4")
    public User user3(@ApiParam("用户对象")@ModelAttribute User user){
        return user;
    }

}
